﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLNS_Public;
using System.Data;

namespace QLNS_Data
{
   public class NhanVien_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();

       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_NhanVien");
       }
       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public int update_NhanVien(NhanVien_Public maNhanVien, NhanVien_Public hoTen, NhanVien_Public ngaySinh, NhanVien_Public gioiTinh, NhanVien_Public tinhTrangHonNhan, NhanVien_Public cMT, NhanVien_Public noiSinh, NhanVien_Public dienThoai, NhanVien_Public maPhong, NhanVien_Public maChucVu, NhanVien_Public maBacLuong, NhanVien_Public ngayVaoLam, NhanVien_Public loaiHopDong, NhanVien_Public ngayKy, NhanVien_Public ngayHetHan, NhanVien_Public tenDangNhap, NhanVien_Public matKhau, NhanVien_Public maQuyen, NhanVien_Public ghiChu, NhanVien_Public trangThai)
       {
           int n = 20;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaNhanVien";
           value[0] = maNhanVien.MaNhanVien;
           name[1] = "@HoTen";
           value[1] = hoTen.HoTen;
           name[2] = "@NgaySinh";
           value[2] = ngaySinh.NgaySinh;
           name[3] = "@GioiTinh";
           value[3] = gioiTinh.GioiTinh;
           name[4] = "@TinhTrangHonNhan";
           value[4] = tinhTrangHonNhan.TinhTrangHonNhan;
           name[5] = "@CMTND";
           value[5] = cMT.CMTND;
           name[6] = "@NoiSinh";
           value[6] = noiSinh.NoiSinh;
           name[7] = "@DienThoai";
           value[7] = dienThoai.DienThoai;
           name[8] = "@MaPhong";
           value[8] = maPhong.MaPhong;
           name[9] = "@MaChucVu";
           value[9] = maChucVu.MaChucVu;
           name[10] = "@MaBacLuong";
           value[10] = maBacLuong.MaBacLuong;
           name[11] = "@NgayVaoLam";
           value[11]=ngayVaoLam.NgayVaoLam;
           name[12] = "@LoaiHopDong";
           value[12] = loaiHopDong.LoaiHopDong;
           name[13] = "@NgayKy";
           value[13] = ngayKy.NgayKy;
           name[14] = "@NgayHetHan";
           value[14] = ngayHetHan.NgayHetHan;
           name[15] = "@TenDangNhap";
           value[15] = tenDangNhap.TenDangNhap;
           name[16] = "@MatKhau";
           value[16] = matKhau.MatKhau;
           name[17] = "@MaQuyen";
           value[17] = maQuyen.Maquyen;
           name[18] = "@GhiChu";
           value[18] = ghiChu.GhiChu;
           name[19] = "@TrangThai";
           value[19] = trangThai.TrangThai;
           return kn.update("Update_NhanVien",name,value,n);
       }
       public int insert_NhanVien(NhanVien_Public hoTen, NhanVien_Public ngaySinh, NhanVien_Public gioiTinh, NhanVien_Public tinhTrangHonNhan, NhanVien_Public cMT, NhanVien_Public noiSinh, NhanVien_Public dienThoai, NhanVien_Public maPhong, NhanVien_Public maChucVu, NhanVien_Public maBacLuong, NhanVien_Public ngayVaoLam, NhanVien_Public loaiHopDong, NhanVien_Public ngayKy, NhanVien_Public ngayHetHan, NhanVien_Public tenDangNhap, NhanVien_Public matKhau, NhanVien_Public maQuyen, NhanVien_Public ghiChu, NhanVien_Public trangThai)
       {
           int n = 19;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@HoTen";
           value[0] = hoTen.HoTen;
           name[1] = "@NgaySinh";
           value[1] = ngaySinh.NgaySinh;
           name[2] = "@GioiTinh";
           value[2] = gioiTinh.GioiTinh;
           name[3] = "@TinhTrangHonNhan";
           value[3] = tinhTrangHonNhan.TinhTrangHonNhan;
           name[4] = "@CMTND";
           value[4] = cMT.CMTND;
           name[5] = "@NoiSinh";
           value[5] = noiSinh.NoiSinh;
           name[6] = "@DienThoai";
           value[6] = dienThoai.DienThoai;
           name[7] = "@MaPhong";
           value[7] = maPhong.MaPhong;
           name[8] = "@MaChucVu";
           value[8] = maChucVu.MaChucVu;
           name[9] = "@MaBacLuong";
           value[9] = maBacLuong.MaBacLuong;
           name[10] = "@NgayVaoLam";
           value[10] = ngayVaoLam.NgayVaoLam;
           name[11] = "@LoaiHopDong";
           value[11] = loaiHopDong.LoaiHopDong;
           name[12] = "@NgayKy";
           value[12] = ngayKy.NgayKy;
           name[13] = "@NgayHetHan";
           value[13] = ngayHetHan.NgayHetHan;
           name[14] = "@TenDangNhap";
           value[14] = tenDangNhap.TenDangNhap;
           name[15] = "@MatKhau";
           value[15] = matKhau.MatKhau;
           name[16] = "@MaQuyen";
           value[16] = maQuyen.Maquyen;
           name[17] = "@GhiChu";
           value[17] = ghiChu.GhiChu;
           name[18] = "@TrangThai";
           value[18] = trangThai.TrangThai;
           return kn.update("Insert_NhanVien", name, value, n);
       }
       public int delete_NhanVien(NhanVien_Public maNhanVien)
       {
           int n = 1;
           string[] name = new string[n];
           object[] value = new object[n];
           name[0] = "@MaNhanVien";
           value[0] = maNhanVien.MaNhanVien;
           return kn.update("Delete_NhanVien", name, value, n);
       }
       }
}
